<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
   <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>商品列表</title>
  	<script src="__INDEX__/js/mui.min.js"></script>
	<link href="__INDEX__/css/mui.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="__INDEX__/css/style.css" />
	<link rel="stylesheet" href="__INDEX__/css/iconfont.css" />
	<link rel="stylesheet" href="__INDEX__/css/mall.css" />
	<script src="__PUBLIC__/static/js/jquery.min.js"></script>
</head>
<style>
	.my_li{
		border-bottom: 1px solid #d6cfcf;
	}
	.mystyl{
	    height: 3rem;
	    width: 100%;
	    line-height: 3rem;
	    text-align: center;
	    border-bottom: 1px solid #E6E6E6;
	    position: relative;
	    border-left: 2px solid -webkit-linear-gradient(red, blue);
	    background: white;
	}
</style>
<body>
	
	<header class="mui-bar mui-bar-nav">
		<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	    <h1 class="mui-title">商品列表</h1>
	</header>
	<div class="mui-content shop_content">
		<div class="list_fenlnav clearfix">
			<div class="mask"></div>
			<dl class="topmenu">
				<dt style="width: 100%;">
					<div class="selectlist">
						<form action="{:url('index/goods_list')}" id='my_form'>
							<input type="hidden" name="agent_id" value="{$agent_id}" />
							<select name="goods_type_id" id='goods_type_id' onchange="post_sel()">
								{if $goods_type_id && $goods_type_id>0}
									{volist name='goods_type' id='vo' }
										{if $vo.id == $goods_type_id}
											<option value="{$vo.id}">{$vo.type_name}</option>
										{/if}
									{/volist}
									<option  value="0">全部分类</option>
									{volist name='goods_type' id='vo' }
										{if $vo.id != $goods_type_id}
											<option value="{$vo.id}">{$vo.type_name}</option>
										{/if}
									{/volist}
								{else}
									<option value="0">请选择商品分类</option>
									<option  value="0">全部分类</option>
									{volist name='goods_type' id='vo' }
										<option value="{$vo.id}">{$vo.type_name}</option>
									{/volist}
								{/if}
							</select>     
						</form>
					</div>	
				</dt>
			</dl>				
		</div>
	    <ul class="sy_tuijlist clearfix xhgoods">
			{volist name="goods_list" id="gd"}
			<li>
				<a href="{:url('index/goodsshow',['goods_id'=>$gd.id])}" empty="该商家未上传商品">
					<div class="sy_tjimg"><img src="{$gd.thumb}"></div>
					<div class="sy_tjinfo">
						<div class="sy_tjnam">{$gd.goods_name}</div>							
						<div class="sy_glj">
							<span class="list_pri">零售价:<em>{$gd.sale_price}</em></span>
							<span>送<em>{$gd.zs_price}</em>元鼓励金</span>
						</div>
						<div class="list_pribox clearfix">							
							<span class="list_pri">会员价:<em>{$gd.sale_price - $gd.dk_price}</em></span>
							<span class="dikou">+<em>{$gd.dk_price}</em>元鼓励金</span>
						</div>
						<div class="list_pribtn"><span class="iconfont icon-kuaiqiang"></span></div>
					</div>
				</a>
			</li>
			{/volist}
		</ul>
	</div>
	<input type="hidden" id='page' value="1" />
</body>
</html>
{include file="public/footer" /}
<script>
//底部加载事件
	$(window).scroll(function() {
		if($(document).scrollTop()+1 >= $(document).height() - $(window).height()) {
			var page = $('#page').val();
			$('#page').val(parseInt(page)+1);
			
			$.ajax({
			   	type:"post",
			   	data:{
			   		agent_id		: "{$agent_id}",
			   		goods_type_id	: $('#goods_type_id').val(),
			   		page			: $('#page').val()
			   	},
			   	url:"{:url('index/shop/goods_list')}",
			   	success:function(data){
			   		var goods_list = data.data;
			   		for(var i=0;i<goods_list.length;i++){
			   			
			   			var html =	"<li>"+
					    			"<a href='/shop/show?goods_id="+goods_list[i]['goods_id']+"'>"+
					    				"<div class='sccp_img'><img src='"+goods_list[i]['logo']+"'></div>"+
					    				"<div class='sccp_infobox'>"+
					    					"<p class='cpname'>"+goods_list[i]['goods_name']+"</p>"+
					    					"<div class='pribox'>"+
					    						"<div class='left'>"+
					    							"<span class='pri'>¥<em>"+goods_list[i]['cost_price']+"</em></span>"+
					    							"<span class='yj'>¥"+goods_list[i]['sale_price']+"</span>"+
					    						"</div>"+
					    						"<div class='right'><span class='iconfont icon-gouwuche'></span></div>"+
					    					"</div>"+
					    				"</div></a></li>";
			   			$('#item_ul').append(html);
			   		} 
			   	}
			})
		}
	});
</script>
<script>
	function post_sel(){
		$('#my_form').submit();
	}
</script>